package com.company.eduservice.controller.front;

import com.company.eduservice.entity.EduCourse;
import com.company.eduservice.entity.EduTeacher;
import com.company.eduservice.service.EduCourseService;
import com.company.eduservice.service.EduTeacherService;
import com.company.utils.R;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/eduservice/indexfront")
@CrossOrigin
public class IndexShow {

    @Resource
    private EduCourseService courseService;

    @Resource
    private EduTeacherService teacherService;

    //查询前8条热门课程 + 前4个讲师
    @GetMapping("/index")
    public R getCourseList() {
        List<EduCourse> list = courseService.getCourseList();
        List<EduTeacher> list1 = teacherService.getTeacherList();
        return R.ok().data("eduList", list).data("teacherList", list1);
    }

}
